package com.foreverwin.mes.lims.service.impl;

import com.foreverwin.mes.core.base.FrontPage;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.foreverwin.mes.core.utils.CommonMethods;
import com.foreverwin.mes.lims.model.UnplannedSampling;
import com.foreverwin.mes.lims.mapper.UnplannedSamplingMapper;
import com.foreverwin.mes.lims.service.UnplannedSamplingService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mark
 * @since 2020-03-11
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UnplannedSamplingServiceImpl extends ServiceImpl<UnplannedSamplingMapper, UnplannedSampling> implements UnplannedSamplingService {


    @Autowired
    private UnplannedSamplingMapper unplannedSamplingMapper;

    @Override
    public Page<UnplannedSampling> selectPage(FrontPage<UnplannedSampling> frontPage, UnplannedSampling unplannedSampling) {
        EntityWrapper<UnplannedSampling> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(unplannedSampling);
        return super.selectPage(frontPage.getPagePlus(), queryWrapper);
    }

    @Override
    public List<UnplannedSampling> selectList(UnplannedSampling unplannedSampling) {
        EntityWrapper<UnplannedSampling> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(unplannedSampling);
        return super.selectList(queryWrapper);
    }

    @Override
    public List<UnplannedSampling> selectInventoryBatch(UnplannedSampling unplannedSampling) {
        return unplannedSamplingMapper.selectInventoryBatch(CommonMethods.getSite());
    }


}